{if $grid.caption}<h3>{$grid.caption}</h3>{/if}


<table width="100%">
	<tr>
		<td width="200">
			<br/>
		
			
				<form method='get' action='{$smarty.server.REDIRECT_URL}?{$filter_url}'>
					<table>
						<tr>
							<td align='center'>	
								<select name='sortby'>
									{foreach from=$grid.labels item=filter key=cid}
										<option value='{$cid}' {if $smarty.get.sortby==$cid}selected='selected'{/if}>{$grid.labels[$cid]}</option>	
									{/foreach}
								</select>
							</td>
						</tr>			
						<tr>
							<td align='center'>		
								{foreach from=$smarty.get.filter item=pr key=cid name=filter_iteration}
									<input type='hidden' name='filter[{$cid}]' value='{$pr}'/>
								{/foreach}
								<strong>Sort:</strong> <input type='submit' name='order' value='ASC'/> <input type='submit' name='order' value='DESC'/>
							</td>
						</tr>
					</table>
				</form>
		
		</td>
		
		<td>	

			<form method='get'>
					{foreach from=$grid.labels item=filter key=cid}
						<div style='float:left'><strong>{$filter}:</strong><br/><input type='text' name='filter[{$cid}]' value='{$smarty.get.filter[$cid]}'/></div>
					{/foreach}
						<div style='float:left'><strong>&nbsp;</strong><br/><input type='submit' value='Filter'/></div>
				{if $smarty.get.sortby}
					<input type='hidden' name='sortby' value='{$smarty.get.sortby}'/>
					<input type='hidden' name='order' value='{$smarty.get.order}'/>
				{/if}
			</form>

		</td>
	</tr>	
</table><br/>


{if $grid.rows}
<table class="contentTable">
	<tr class="table_head">
		{foreach from=$grid.labels item=grd key=cid}
		<td>{$grd}</td>
		{/foreach}
		
		{if $grid.edit_action!=''||$grid.delete_action!=''}
		<td {if $grid.edit_action!=''&&$grid.delete_action!=''}colspan="2"{/if}>
			&nbsp;
		</td>
		{/if}

				
	</tr>
	
	{foreach from=$grid.rows item=row key=cid}
	<tr onmouseover="this.style.backgroundColor='#eee'" onmouseout="this.style.backgroundColor='white'">
		{foreach from=$row item=cell key=field_name}
			{if $field_name!='key'}
			<td>
				{$cell}
			</td>
			{/if}
		{/foreach}
		
		{if $grid.edit_action}
		<td>
			<a href='{$grid.edit_action}/{$grid.key}/{$row.key}'><img src='{$theme}images/icons/next.png' border="0"/></a>
		</td>
		{/if}

		{if $grid.delete_action}
		<td>
			<a href='{$grid.delete_action}/{$grid.key}/{$row.key}' onclick="if(!confirm('Are you sure?'))return false;"><img src='{$theme}images/icons/remove.png' border="0"/></a>
		</td>
		{/if}
	</tr>	
	{/foreach}
</table>


{if $paging->pageCount>1}


<br/>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td align="center">
			<table cellpadding="4" cellspacing="0" border="0">
				<tr>
					{section name=paging loop=$paging->last}
						<td {if $smarty.section.paging.iteration==$paging->current}bgcolor="#f5dd95"{/if}><a {if $smarty.section.paging.iteration==$paging->current}class="menu" style="font-weight:bold"{else}class="un_line"{/if} href='{$paging->url}{$smarty.section.paging.iteration}&{foreach from=$smarty.get.filter item=pr key=cid name=filter_iteration}filter[{$cid}]={$pr}&{/foreach}sortby={$smarty.get.sortby}&order={$smarty.get.order}'>&nbsp;{$smarty.section.paging.iteration}&nbsp;</a></td>
						{if $smarty.section.paging.iteration%20==0}</tr><tr>{/if}					
					{/section}				
				</tr>
			</table>
		</td>
	</tr>
</table>
{/if}

{else}
<br/>
List is empty
<br/>
{/if}
{if $grid.add_action}<br/><a href={$grid.add_action}><img src='{$theme}images/icons/add.png' border="0"></a>{/if}